package uk.ac.glasgow.demosocs.tests;

import static org.junit.Assert.*;

import java.util.Date;

import org.junit.Before;
import org.junit.Test;

import uk.ac.glasgow.demosocs.Election;
import uk.ac.glasgow.demosocs.ElectionState;
import uk.ac.glasgow.demosocs.VotingSystem;

public class OpenNominationsTest {
	private VotingSystem vs;
	private Election e;
	
	@Before
	public void setUp() throws Exception {
		//vs = new VotingSystem();
		vs.setCurrentUser("admin", "passwrd");
		vs.createElection("Test Election", "AV");
		e = vs.getCurrentElection();
		
		@SuppressWarnings("deprecation") Date nominationDate = new Date(2012, 2, 14);
		@SuppressWarnings("deprecation") Date startDate = new Date(2012, 2, 15);
		@SuppressWarnings("deprecation") Date endDate = new Date(2012, 2, 22);
		
		vs.editElection(nominationDate, startDate, endDate, e.getEID());
		assertEquals("Open date not set.", e.getOpenNominations(), nominationDate);
		assertEquals("Start date not set.", e.getStart(), startDate);
		assertEquals("End date not set.", e.getEnd(), endDate);
	}
	
	@Test
	public void test() {
		assertEquals(e.getElectionState(), ElectionState.NOMINATIONS_OPEN);
	}

}
